package com.woniu.car.controller;


import com.woniu.car.common.ResponseEntity;
import com.woniu.car.exception.ParamException;
import com.woniu.car.exception.ServiceSException;
import com.woniu.car.param.*;
import com.woniu.car.service.TProductCommentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author chestnuts
 * @since 2021-06-21
 */
@Api(tags = "订单评论模块")
@RestController
@RequestMapping("/tProductComment")
public class TProductCommentController {
    @Resource
    private TProductCommentService tServiceCommentService;


    @PostMapping("/insertComment")
    @ApiOperation("新增评论")
    public ResponseEntity insertComment(@Validated GoodsCommentInsterParam goodsCommentInsterParam) throws ParamException {

        ResponseEntity responseEntity = tServiceCommentService.insertComment(goodsCommentInsterParam);

        return responseEntity;
    }

    @PutMapping("/addedCommentByUser")
    @ApiOperation("用户追评")
    public ResponseEntity addedCommentByUser(@Validated AddCommentByUserParam addCommentByUserParam){

        ResponseEntity responseEntity = tServiceCommentService.addCommentByUser(addCommentByUserParam);

        return responseEntity;
    }


    @GetMapping("/queryComment")
    @ApiOperation("查询评论")
    public ResponseEntity queryComment(@Validated  QueryGoodsCommentParam queryGoodsCommentParam) throws ServiceSException, ParamException {

        ResponseEntity responseEntity = tServiceCommentService.queryComment(queryGoodsCommentParam);

        return responseEntity;
    }





//    @PutMapping("/updateByShop")
//    @ApiOperation("商家回复")
//    public ResponseEntity addCommentByShop(@Validated AddCommentByShopParam addCommentByShopParam) throws ServiceSException {
//
//        ResponseEntity responseEntity = tServiceCommentService.updateByShop(addCommentByShopParam);
//
//        return responseEntity;
//    }
//
//
//    @PutMapping("/updateByShop")
//    @ApiOperation("商家追评回复")
//    public ResponseEntity addedCommentByShop(@Validated AddedCommentParam addedCommentParam) throws ServiceSException {
//
//        ResponseEntity responseEntity = tServiceCommentService.updateByShop(addedCommentParam);
//
//        return responseEntity;
//    }


    @PutMapping("/delComment")
    @ApiOperation("用户删除评论")
    public ResponseEntity delComment(DelCommentParam delCommentParam){

        ResponseEntity responseEntity = tServiceCommentService.delComment(delCommentParam);

        return responseEntity;
    }

}

